<template>
  <div class="technicItem" v-if="info">
    <div class="left">
      <div class="left-top van-multi-ellipsis--l2">
        {{ info.title }}
      </div>
      <div class="left-bottom">
        <div class="left-bottom-item1">{{ info.updated_at | formatTime }}</div>
        <i class="iconfont icon-item">&#xe644;</i>
        <div class="left-bottom-item2">{{ info.read }}</div>
        <i class="iconfont icon-item">&#xe639;</i>
        <div class="left-bottom-item3">{{ info.star }}</div>
      </div>
    </div>
    <img class="right" v-if="info.cover" :src="baseUrl + info.cover" alt="" />
  </div>
</template>

<script>
import moment from 'moment'
export default {
  props:{
    info:{
      type:Object
    }
  },
  data() {
    return {
      baseUrl: process.env.VUE_APP_URL
    }
  },
  filters:{
    formatTime(val){
      const _diff =moment().diff(moment(val),'M')
      if(_diff < 1){
        return '刚刚'
      }else if(_diff > 1 && _diff < 12){
        return _diff + '个月前'
      }else{
        return moment(val).format('YYYY.MM.DD HH:mm:ss')
      }
    }
  }
};
</script>

<style lang="less" scoped>
.technicItem {
  display: flex;
  padding: 0 @p15;
  margin-top: 24px;
  .left {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .left-top {
      font-size: 14px;
      font-family: PingFangSC, PingFangSC-Medium;
      font-weight: 600;
      text-align: left;
      color: #181a39;
      line-height: 22px;
      letter-spacing: 0px;
      margin-bottom: 10px;
    }
    .left-bottom {
      display: flex;
      font-size: 12px;
      font-family: PingFangSC, PingFangSC-Regular;
      font-weight: 400;
      text-align: left;
      color: #b4b4bd;
      line-height: 16px;
      letter-spacing: 0px;
      .left-bottom-item1 {
        flex: 1;
      }
      .left-bottom-item2 {
        margin-right: 21px;
      }
      .icon-item {
        margin-right: 7px;
      }
    }
  }
  .right {
    width: 113px;
    height: 75px;
    object-fit: contain;
    border-radius: 10px;
    margin-left: 16px;
  }
}
</style>